<?php
/*
 * Get the password forget questions and asnwers
 */
if (!F3::exists('POST.email')):
	header('HTTP/1.1 500 Internal Server Error');
	header("Content-Type: application/json");
	$err = array("error_message" => "Need an email address");
	echo json_encode($err);
	return;
endif;

$email = F3::get('POST.email');

$param = array('1'=>$email);

$r = DB::sql("SELECT pfq from user where email = ?",$param);

if(count($r)==0){
	header('HTTP/1.1 500 Internal Server Error');
	header("Content-Type: application/json");
	$err = array("error_message" => "Email does not exist.","1"=>$email);
	echo json_encode($err);
	return;
}

if(count($r)>1){
	header('HTTP/1.1 500 Internal Server Error');
	header("Content-Type: application/json");
	$err = array("error_message" => "Error in searching for email.  Please try again.");
	echo json_encode($err);
	return;
}

$r = $r[0];
$response = array("pfq" => $r['pfq']);
echo json_encode($response);
return;
?>